#include "BBN.h"


int main(int argc, char* argv[])
{
    Screen screen(800, 600);
    if(screen.failed())
    {
        print_line("Failed to initialize.");
        return 1;
    }
    
    
    Image sprite_image("data/test1.png");
    if(sprite_image.failed())
    {
        print_line("Failed to load image.");
        return 1;
    }
    
    float x = 400;
    float y = 300;
    
    Input input;
    bool done = false;
    while(!done)
    {
        while(input.next_event())
        {
            if(input.is_quit() || input.key_pressed(SDL_SCANCODE_ESCAPE))
                done = true;
        }
        
        if(input.key_held(SDL_SCANCODE_UP))
            y -= 1;
        else if(input.key_held(SDL_SCANCODE_DOWN))
            y += 1;
        if(input.key_held(SDL_SCANCODE_LEFT))
            x -= 1;
        else if(input.key_held(SDL_SCANCODE_RIGHT))
            x += 1;
        
        screen.clear();
        screen.draw(sprite_image, x, y);
        
        screen.show();
        
        wait(0.01f);
    }
    
	return 0;
}

